<?php
 
// No direct access
 
defined('_JEXEC') or die('Restricted access'); 

//add javascript
$js1 = JURI::base().'components/com_nv/assets/js/jquery.js';
$js2= JURI::base().'components/com_nv/assets/js/jquery.bgiframe.min.js';
$js3 = JURI::base().'components/com_nv/assets/js/jquery.ajaxQueue.js';
$js4 = JURI::base().'components/com_nv/assets/js/jquery.autocomplete.js';

$document 	=& JFactory::getDocument();
$document->addScript('components/com_nv/assets/js/livevalidation.js');

// add css
$css1 = JURI::base().'components/com_nv/assets/css/common.css';

?>

<script type="text/javascript" src="<?echo $js1 ?>"></script>
<script type="text/javascript" src="<?echo $js2 ?>"></script>
<script type="text/javascript" src="<?echo $js3 ?>"></script>
<script type="text/javascript" src="<?echo $js4 ?>"></script>

<link rel="stylesheet" href=<?echo $css1 ?> type="text/css" media="screen" />

<script type="text/javascript">
$().ready(function() {

$("#teksinput").autocomplete([

<? foreach($this->data as $list){
	echo "\"".$list->kota."\", ";
}?> ], {
		width: 320,
		max: 4,
		highlight: false,
		multiple: false,
		multipleSeparator: " ",
		scroll: true,
		scrollHeight: 300,
		autoFill: true
	});

});
</script>

<form action="index.php?option=com_nv&view=allhotel" method="post" name="adminForm" id="adminForm">
<fieldset class="adminform">
<legend>Cari Semua Hotel</legend>
<table class="admintable">

<tr>
<td>
Masukkan Inputan :
</td>
<td width="100" align="right" class="key">
<input name="field_cari" type="text" id="teksinput" class="input"  id="field_cari" />
    <script type="text/javascript">
        var field_cari = new LiveValidation('field_cari');
        field_cari.add( Validate.Presence ,{ failureMessage: "Harus Diisi..!!" });
    </script>
</td>

<td>
<input name="cari" type="submit" value="cari" class="button" />
</td>
</tr>
</table>

<?php
	if (($_POST[field_cari]&&$this->rss)||$this->input){

        if (empty ($_POST[field_cari])){
            $namaInput = $this->input;
        }else {
            $namaInput = $_POST[field_cari];
        }

        $items = $this->rss->get_items();

        $jumlah_hotel = $this->rss->get_item_quantity();
        $out .= "Ditemukan <b>$jumlah_hotel</b> hotel di <b>".$namaInput."</b> : <br/><br/>";
        $i=1;

			foreach($items as $item)
			{
                $out .= "<b>$i. ".'<em>'.$item->get_title().'</em></b><br/>';
                $out .= $item->get_description().'<br/><br/>';
            $i++;
			}//end of foreach
?>
<div class="result">
    
<fieldset>

<legend>Sumber : http://www.indonesia-tourism.com/</legend>
<div class="border">
<?
        echo "<br />";
        echo $out;
?>
</div>
</fieldset>

</div>
<?
	}// akhir dari if

    else if (($_POST[field_cari]&&empty($this->rss))||$this->input){
        if (empty ($_POST[field_cari])){
            $namaInput = $this->input;
        }else {
            $namaInput = $_POST[field_cari];
        }

        $out = "Hasil Pencarian Terhadap <strong>".$namaInput."</strong> Tidak Menemukan Hasil";
        echo "<br />";
        echo $out;
    }
    ?>
    
</fieldset>
</form>